package com.kakarote.oa.service;

import com.alibaba.fastjson.JSONObject;
import com.kakarote.common.log.entity.OperationLog;
import com.kakarote.core.entity.BasePage;
import com.kakarote.core.feign.examine.entity.ExamineConditionDataBO;
import com.kakarote.core.feign.examine.entity.ExamineFlowFieldUpdateLogBO;
import com.kakarote.core.feign.examine.entity.ExamineInfoVo;
import com.kakarote.core.feign.examine.entity.ExamineUpdateFieldBO;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.oa.entity.BO.AuditExamineBO;
import com.kakarote.oa.entity.BO.ExamineExportBO;
import com.kakarote.oa.entity.BO.ExaminePageBO;
import com.kakarote.oa.entity.BO.GetExamineFieldBO;
import com.kakarote.oa.entity.PO.OaExamine;
import com.kakarote.oa.entity.PO.OaExamineCategory;
import com.kakarote.oa.entity.PO.OaExamineField;
import com.kakarote.oa.entity.VO.ExamineVO;
import com.kakarote.oa.entity.VO.OaExamineVO;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 审批表 服务类
 * </p>
 *
 * @author wyq
 * @since 2020-05-15
 */
public interface IOaExamineService extends BaseService<OaExamine> {

    BasePage<ExamineVO> myInitiate(ExaminePageBO examinePageBO);

    BasePage<ExamineVO> myOaExamine(ExaminePageBO examinePageBO);

    List<OaExamineField> getField(GetExamineFieldBO getExamineFieldBO);

    List<List<OaExamineField>> getFormPositionField(GetExamineFieldBO getExamineFieldBO);

    OperationLog setOaExamine(JSONObject jsonObject);

    void oaExamine(AuditExamineBO auditExamineBO);

    ExamineVO queryOaExamineInfo(String examineId);

    JSONObject queryExamineRecordList(String recordId);

    List<JSONObject> queryExamineLogList(Long recordId);

    OperationLog deleteOaExamine(Long examineId);

    OaExamineCategory queryExaminStep(Long categoryId);

    List<Map<String, Object>> export(ExamineExportBO examineExportBO, ExamineInfoVo examineInfoVo, List<OaExamineField> fieldList);

    public List<ExamineVO> transfer(List<ExamineVO> recordList);

    Map<String, Object> getDataMapForNewExamine(ExamineConditionDataBO examineConditionDataBO);

    Boolean updateCheckStatusByNewExamine(ExamineConditionDataBO examineConditionDataBO);

    ExamineVO getOaExamineById(Long oaExamineId);

    Map<Long,ExamineVO> getOaExamineMapByIds(List<Long> oaExamineIds);

    List<OaExamineVO> queryLeaveExamineList(Map<String, Object> map);

    List<Map<String, Object>> getAllFieldLanguageRel();

    void setOaExamineDraft(JSONObject jsonObject);


    /**
     * 获取审批关联信息
     *
     * @param oaExamineId
     */
    Map<Integer, Set<Long>> getRelation(Long oaExamineId);

    /**
     * 通过fieldId查询出审批ID
     *
     * @param fieldId
     * @return
     */
    List<String> queryLeaveTypeList(Long fieldId);

    void updateFieldInfo(ExamineUpdateFieldBO examineUpdateFieldBO);

    List<Map<String, Object>> queryExamineUpdateLog(List<ExamineFlowFieldUpdateLogBO> list);

    /**
     * 更换审批关联信息ID
     * @param type 关联类型
     * @param oldId 原ID
     * @param newId 新ID
     */
    void updateExamineRelId(Integer type, Long oldId, Long newId);
}
